﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;

namespace SimpleFactory
{
    /// <summary>
    /// 简单工厂
    /// </summary>
    class Program
    {
        static void Main(string[] args)
        {
            EmployeeDal edSql = new EmployeeDal("sql");
            edSql.GetAll("selct sql");

            EmployeeDal edOra = new EmployeeDal("oracle");
            edOra.GetAll("selct oracle");
        }

    }

    public class EmployeeDal
    {
        IDataBase db = null;
        public EmployeeDal(string dbType)
        {
            switch (dbType)
            {
                case "sql":
                    db = new SqlHelper();
                    break;
                default:
                    db = new OracleHelper();
                    break;
            }
        }
        public DataTable GetAll(string sql)
        {
            return db.GetDataTable(sql);
        }
    }

}
